package com.czz.Constant;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import com.czz.Radio.Radio;
import com.czz.Tool.ConfigSAXParser;

public class RadioConfig {
	
	public Map<Integer, Radio> radioConfigCache = new HashMap<Integer, Radio>();

	public static RadioConfig instance = new RadioConfig();
	
	private RadioConfig(){
		InputStream inputStream = this.getClass().getResourceAsStream(Constants.CONFIG_FILE_PATH);
		try {
			for(Radio radio : ConfigSAXParser.parseXml(inputStream)) {
				radioConfigCache.put(radio.getId(), radio);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	
}
